<template>
    <div>
        <div style="position: absolute; left: 0; top: 10px; z-index: 100">
            <a-icon type="left-circle" theme="filled"  style="font-size: 20px; color: #48D3A4;"  @click="back"/>
        </div>
        <div class="infoIpt">
            <a-row :gutter="16">
                <a-col :xl="6" :lg="24" :md="24" :sm="24" :xs="24">
                    <a-card style="min-height: 450px;">
                        <template #title>
                            <a-row>
                                <a-col span="18">
                                    <div style="font-size: 1.2rem; font-weight: bold; color: #189583">
                                        <a-icon type="info-circle"/> &nbsp;专家信息
                                    </div>
                                </a-col>
                                <a-col span="6">
                                    <div style="font-size: 1.2rem; font-weight: bold; color: #189583; cursor: pointer;">
                                        <a-popover trigger="click">
                                            <template slot="content">
                                                <template v-for="(item, index)  in likeData">
                                                    <a-row style="width: 280px; font-size: 13px; line-height: 30px; font-weight: bold; ">
                                                        <a-col span="10" style="text-align: right;">{{item.likeItem}}：</a-col>
                                                        <a-col span="12">
                                                            <a-rate :allowClear="false" v-model="item.likeCount" @change="changeLike(index, item.likeCount)"/>
                                                        </a-col>
                                                    </a-row>
                                                </template>
                                            </template>
                                            <a-icon type="like"/>
                                        </a-popover> &nbsp; &nbsp;
                                        <a-icon type="file-search"/> &nbsp;
                                    </div>
                                </a-col>
                            </a-row>
                        </template>
                        <div>
                            <a-row :gutter="16" type="flex" justify="space-around">
                                <a-col span="12" style="display: flex; justify-content: center;">
                                    <a-avatar shape="square" :size="80"
                                              :src="talentInfo.talentPhoto != null ? talentInfo.talentPhoto : talentInfo.talentGender != null ? talentInfo.talentGender== '男' ? manPhoto : womanPhoto : unknownPhoto"/>
                                </a-col>
                                <a-col span="12">
                                    <div class="t-title">{{ talentInfo.talentRealName }}</div>
                                    <div class="t-company" :title="talentInfo.talentCompany">{{ talentInfo.talentCompany }}</div>
                                </a-col>
                            </a-row>
                            <br/>
                            <a-row v-if="talentInfo.talentPartPhoneNumber != ''">
                                <a-col span="24">
                                    <div class="title">
                                        电话:
                                        <span
                                            style="font-weight: bold; padding-left: 20px;">{{
                                                talentInfo.talentPartPhoneNumber == null ? '待补充' : talentInfo.talentPartPhoneNumber
                                            }}</span>
                                    </div>
                                </a-col>
                            </a-row>
                            <br/>
                            <a-row v-if="talentInfo.talentIntro != ''">
                                <a-col span="24">
                                    <div class="title">
                                        简介: <span v-if="talentInfo.talentIntro == null"
                                                    style="font-weight: bold; padding-left: 20px;">待补充</span>
                                    </div>
                                    <div class="title" v-if="talentInfo.talentIntro != null ">
                                        <div
                                            style="font-weight: bold; line-height: 25px; text-align: justify; text-indent: 2em">
                                            {{ talentInfo.talentIntro }}
                                        </div>
                                    </div>
                                </a-col>
                            </a-row>
                            <br/>
                            <a-row>
                                <a-col span="24">
                                    <div class="title">
                                        研究领域:<br/>
                                        <div v-if="talentFields != null">
                                            <template v-for="(tag,index) in talentFields">
                                                <a-tag :title="tag" v-if="index<10"
                                                       style="line-height: 20px; background: #fff; color: #19927F; border-style: solid; border-color: #19927F; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;  max-width: 100px; float: left;">
                                                    {{ tag }}
                                                </a-tag>
                                            </template>
                                        </div>
                                        <div v-else style="font-weight: bold; padding: 20px;">待补充</div>
                                    </div>
                                </a-col>
                            </a-row>
                        </div>
                    </a-card>
                    <a-card style="min-height: 490px;">
                        <template #title>
                            <div style="font-size: 1.2rem; font-weight: bold; color: #189583">
                                <a-icon type="usergroup-delete" style=" font-weight: bold" size="25"/> &nbsp;专家相关性分析
                            </div>
                        </template>
                        <div v-show="talentRelatedYgDataList && talentRelatedYgDataList.length>0">
                            <div ref="groupYgCharts" style=" height: 400px; width: 100%;"></div>
                        </div>
                        <div v-show="talentRelatedYgDataList== null">
                            <div class="blank-content">
                                <a-empty/>
                            </div>
                        </div>
                    </a-card>
                </a-col>
                <a-col :xl="10" :lg="24" :md="24" :sm="24" :xs="24">
                    <div style="height: 400px; border: 1px solid #e8e8e8; background: #fff;">
                        <div class="divTitle">
                            <a-icon type="pie-chart" style="font-weight: bold" size="25"/> &nbsp;专家成果分析
                        </div>
                        <a-tabs type="card" @change="handleTabChange">
                            <a-tab-pane key="rrff" tab="研究领域成果分布">
                                <div v-show="talentRelatedResearchFieldFruitDataList && talentRelatedResearchFieldFruitDataList.length>0">
                                    <div ref="researchFieldChart" style="height: 400px; width: 100%;"></div>
                                </div>
                                <div v-show="talentRelatedResearchFieldFruitDataList== null">
                                    <div class="blank-content">
                                        <a-empty/>
                                    </div>
                                </div>
                            </a-tab-pane>
                            <a-tab-pane key="2" tab="成果词云">
                                <div v-show="talentFruitWordCloudDataList && talentFruitWordCloudDataList.length>0">
                                    <word-cloud-index :data="wordData" :width="450" v-if="isHaveWordData"></word-cloud-index>
                                </div>
                                <div v-show="talentFruitWordCloudDataList== null">
                                    <div class="blank-content">
                                        <a-empty/>
                                    </div>
                                </div>
                            </a-tab-pane>
                        </a-tabs>
                    </div>
                    <br/>
                    <a-card style="height: 600px;">
                        <template #title>
                            <div style="font-size: 1.2rem; font-weight: bold; color: #189583">
                                <a-icon type="file" style=" font-weight: bold" size="25"/> &nbsp;个人成果
                            </div>
                        </template>
                        <div style="height: 480px; overflow-y: auto; overflow-x: hidden;">
                            <a-row>
                                <a-col>
                                    <div class="demo-spin-div" v-if="!isHaveData">
                                        <a-spin tips="">
                                            <div class="spin-content">
                                                成果数据加载中。。。
                                            </div>
                                        </a-spin>
                                    </div>
                                    <div v-if="isHaveData">
                                        <a-col span="24">
                                            <div v-if="productions.dataList.length > 0" style="padding-left: 10px;">
                                                <div v-for="item in productions.dataList" :key="item.id">
                                                    <a-row>
                                                        <a-col span="20">
                                                            <div class="ft" @click="showFruitInfo(item)">
                                                                {{ item.fruitName }}
                                                            </div>
                                                        </a-col>
                                                        <a-col span="4" style="text-align: right;">
                                                            <a-tag color="#189583"
                                                                   style="font-size: 15px;border-radius: 10px;padding: 0 10px;text-align: center;}">
                                                                <span>{{getFruitTypeName(item.fruitType)}}</span>
                                                            </a-tag>
                                                        </a-col>
                                                    </a-row>
                                                    <a-row style="margin-top: 5px;">
                                                        <a-col span="24">
                                                            <template v-if="item.fruitKeywords">
                                                                <template v-for="tag in item.fruitKeywords.split(',')">
                                                                    <a-tag :key="tag"
                                                                           style="line-height: 20px; border-style: dashed; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;  max-width: 200px; float: left;">
                                                                        {{ tag }}
                                                                    </a-tag>
                                                                </template>
                                                            </template>
                                                        </a-col>
                                                    </a-row>
                                                    <a-row style="margin-top: 5px;">
                                                        <a-col span="18">
                                                            <div style="font-size: 15px; ">
                                                                <div v-if="item.tagList">
                                                                <span v-for="(tagGroup, index) in item.tagList"
                                                                      :key="index">
                                                                  <span
                                                                      v-if="tagGroup.tagTypeName === 'fruit_author_names'">
                                                                    <span v-for="(author, idx) in tagGroup.tagNameList"
                                                                          :key="idx">
                                                                      {{ author.tagName }}
                                                                      <span
                                                                          v-if="idx < tagGroup.tagNameList.length - 1">, </span>
                                                                    </span>
                                                                  </span>
                                                                </span>
                                                                </div>
                                                            </div>
                                                            <!--                                                        <div style="display: inline-block; font-size: 15px; padding-left: 30px;">{{item.orgName}}</div>-->
                                                        </a-col>
                                                        <a-col span="6" style="text-align: right; ">
                                                            <div style="font-size: 15px">
                                                                {{ item.fruitPubTime}}
                                                            </div>
                                                        </a-col>
                                                    </a-row>
                                                    <!--                                                <a-row style="margin-top: 5px;">-->
                                                    <!--                                                    <a-col span="20">-->
                                                    <!--                                                        <div style="color: #189583; padding-right: 10px; font-size: 13px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; ">{{item.field}}</div>-->
                                                    <!--                                                    </a-col>-->
                                                    <!--                                                    <a-col span="4" style="text-align: right; padding-right: 20px;">-->
                                                    <!--                                                        <div style="font-size: 15px">{{item.pubTime.substring(0,10)}}</div>-->
                                                    <!--                                                    </a-col>-->
                                                    <!--                                                </a-row>-->
                                                    <a-divider/>
                                                </div>
                                            </div>
                                            <div v-else>
                                                <div class="blank-content">
                                                    <a-empty/>
                                                </div>
                                            </div>
                                        </a-col>
                                    </div>
                                </a-col>
                            </a-row>
                        </div>
                        <a-row>
                            <a-col span="24">
                                <div class="pag">
                                    <a-pagination :current="currentPage"
                                                  :total="parseInt(productions.total)"
                                                  :show-total="total => `共 ${total} 条`"
                                                  @change="onChangePage"/>
                                </div>
                            </a-col>
                        </a-row>
                    </a-card>
                </a-col>
                <a-col :xl="8" :lg="24" :md="24" :sm="24" :xs="24">
                    <div style="height: 400px; border: 1px solid #e8e8e8; background: #fff;">
                        <div class="divTitle">
                            <a-icon type="bar-chart" style="font-weight: bold" size="25"/> &nbsp;专家合作情况
                        </div>
                        <a-tabs type="card" @change="handleTabChange">
                            <a-tab-pane key="rank" tab="合作排名">
                                <div v-show="talentRelatedTalentDataList && talentRelatedTalentDataList.length>0">
                                    <div ref="groupRankCharts" style=" height: 350px; width: 100%;"></div>
                                </div>
                                <div v-show="talentRelatedTalentDataList== null">
                                    <div class="blank-content">
                                        <a-empty/>
                                    </div>
                                </div>
                            </a-tab-pane>
                            <a-tab-pane key="related" tab="合作学者">
                                <div v-show="talentRelatedTalentDataList && talentRelatedTalentDataList.length>0">
                                    <div ref="groupTalentCharts" style="height: 350px; width: 100%;"></div>
                                </div>
                                <div v-show="talentRelatedTalentDataList== null">
                                    <div class="blank-content">
                                        <a-empty/>
                                    </div>
                                </div>
                            </a-tab-pane>
                        </a-tabs>
                    </div><br/>
                    <a-card style="height: 600px;">
                        <template #title>
                            <div style="font-size: 1.2rem; font-weight: bold; color: #189583">
                                <a-icon type="line-chart" style=" font-weight: bold" size="25"/> &nbsp;专家研究趋势
                            </div>
                        </template>
                        <div v-show="talentResearchTrendDataList && talentResearchTrendDataList.length>0">
                            <div ref="researchCharts" style="height: 500px; width: 100%;"></div>
                        </div>
                        <div v-show="talentResearchTrendDataList== null">
                            <div class="blank-content">
                                <a-empty/>
                            </div>
                        </div>
                    </a-card>
                </a-col>
            </a-row>
        </div>
        <fruit-info ref="fruitInfo"></fruit-info>

        <a-modal :width="1000" v-model="uploadModal" title="共享资源信息" :mask-closable="false" :footer="null">
            <a-upload
                name="file"
                :showUploadList="false"
                :beforeUpload="fileBeforeUpload"
                :action="$uploadUrl"
                :data="uploadData"
                @change="uploadSuccess"
            >
                <a-button type="primary" icon="plus"> 上传资源</a-button>
            </a-upload>
            <br/>

            <!-- 列表展示 -->
            <a-table :columns="columns" :dataSource="talentFileData.dataList" :loading="isHaveFileData" :rowKey="record => record.id" :pagination="false">
                <template slot="action" slot-scope="text, record">
                    <a-popconfirm
                        title="是否确认删除此条数据?"
                        ok-text="是"
                        cancel-text="否"
                        @confirm="deleteFile(record)"
                        v-if="record.uploadUserId == uploadData.uploadUserId"
                    >
                        <a-button type="danger">删除</a-button>
                    </a-popconfirm> &nbsp; &nbsp;
                    <a-button type="primary" @click="downloadFileData(record)">下载</a-button>
                </template>
            </a-table>
            <br/>
            <!-- 分页器 -->
            <a-pagination :show-total="total => `共${total}条`" :total="talentFileData.total" :current="pagination.current" :pageSize="pagination.pageSize" @change="onChangeTalentFilePage" />

        </a-modal>

        <div id="components-back-top-demo-custom">
            <a-back-top>
                <div class="ant-back-top-inner">
                    <a-icon type="up-circle" theme="filled"/>
                </div>
            </a-back-top>
        </div>
    </div>
</template>

<script>

import * as echarts from "echarts";
import Setting from '@/setting';
import photo from '../../common/photo.png'
import womanPhoto from '../../common/womanPhoto.png'
import manPhoto from '../../common/manPhoto.png'
import unknownPhoto from '../../common/unknownPhoto.png'
import {commonPostAction, downloadData, downloadFile, postAction} from '@/api/esManage'
import {getFruitTypeName} from '@/utils/tools'
import fruitInfo from '../../FruitInfo.vue'
import wordCloudIndex from '../../common/wordCloud/wordcloudIndex.vue'

function getRandomArrayElements(arr, count) {
    let shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
    while (i-- > min) {
        index = Math.floor((i + 1) * Math.random());
        temp = shuffled[index];
        shuffled[index] = shuffled[i];
        shuffled[i] = temp;
    }
    return shuffled.slice(min);
}

export default {
    name: 'TalentInfo',
    props: {
        talentId: {
            type: String
        },
        talentName: {
            type: String
        }
    },
    components: {
        fruitInfo,
        wordCloudIndex
    },
    data() {
        return {
            photo: photo,
            womanPhoto: womanPhoto,
            manPhoto: manPhoto,
            unknownPhoto: unknownPhoto,
            loading: false,
            searchTalentFruitObj: {
                current: 1,
                pageNo: 1,
                pageSize: 10,
                sortField: "fruitPubTime"
            },
            selectedAuthorId: "",
            selectedAuthorName: "",
            gwFieldNames: [],
            researchTags: [],
            talentInfo: {},
            talentFields: [],
            talentFileNum: 0,
            currentYear: "",
            yearList: [],
            selectedFruitType: 6,
            currentPage: 1,
            searchObj: {
                pageNo: 1,
                pageSize: 10
            },
            fruitTypeList: [
                {"name": "学术论文", "value": 6},
                {"name": "研究报告", "value": 3},
                {"name": "图书出版", "value": 7},
                {"name": "活动成果", "value": 4},
                {"name": "媒体成果", "value": 5},
                {"name": "荣誉信息", "value": 8},
                {"name": "专利成果", "value": 11},
                {"name": "软著成果", "value": 12},
            ],
            isHaveData: true,
            productions: {
                dataList: []
            },
            isHaveWordData: false,
            wordData: [],
            talentRecommendData: [],
            talentResearchTrendDataList: [],
            talentRelatedResearchFieldFruitDataList: [],
            talentFruitWordCloudDataList: [],
            talentRelatedYgDataList: [],
            talentRelatedTalentDataList: [],

            uploadModal:false,
            searchTalentFileObj: {
                relationId: "",
                pageNo: 1,
                pageSize: 10
            },
            isHaveFileData: true,
            talentFileData: {
                total: 0,
                dataList: []
            },
            currentFilePage: 1,
            talentFileList: [],
            uploadData: {
                relationId: '',
                uploadUserId: ''
            },
            columns: [
                {
                    title: "序号",
                    dataIndex: "key",
                    align: "center",
                    customRender: (text,record,index) => `${index+1}`,//此处为重点
                },
                {
                    title: '资源名称',
                    dataIndex: 'name'
                },
                {
                    title: '上传人',
                    dataIndex: 'uploadUserName',
                },
                {
                    title: '上传时间',
                    dataIndex: 'createTime',
                    customRender: (text,record) => `${record.createTime == null || record.createTime == '' ? '' : record.createTime.substring(0, 10)}`,//此处为重点
                },
                {
                    title: '操作',
                    dataIndex: 'action',
                    scopedSlots: { customRender: 'action' }
                }
            ],
            pagination: {
                current: 1,
                pageSize: 10
            },
            searchTalentLikeObj: {
                talentId: "",
                userId: 1
            },
            likeData:[
                {"likeItem": "专业与合作素养", "sortIndex": 1, "likeCount": 0},
                {"likeItem": "研究成果与贡献", "sortIndex": 2, "likeCount": 0},
                {"likeItem": "项目参与度", "sortIndex": 3, "likeCount": 0},
                {"likeItem": "协作效果", "sortIndex": 4, "likeCount": 0},
                {"likeItem": "协作潜力", "sortIndex": 5, "likeCount": 0},
            ]
        }
    },
    computed: {},
    mounted() {
    },
    created() {
        this.$nextTick(() => {
            this.showInfo(this.talentId, this.talentName);
            console.log(this.talentId, this.talentName);
        })
        // this.showInfo(this.$route.query.t, this.$route.query.c);
    },
    methods: {
        getFruitTypeName,
        back() {
            this.$emit('toShowParent', false);
        },
        getYear() {
            this.yearList = [];
            //取最近5年
            let currentYear = new Date().getFullYear();
            this.currentYear = currentYear;
            for (let n in 10) {
                this.yearList.push({"name": currentYear - n, "value": currentYear - n});
            }
        },
        showInfo(authorId, authorName) {
            this.selectedAuthorId = authorId;
            this.selectedAuthorName = authorName;
            this.$nextTick(function () {
                // this.getYear();
                this.getTalentInfoData();
            })

            window.scrollTo({
                top: 0,
                behavior: 'smooth', // 使用平滑滚动
            });
        },
        getTalentFieldTagData() {
            // let url = "/fruit/getTalentFieldTagData";
            //
            // let obj = {orgUserId : this.selectedAuthorId};
            // let that = this;
            // postAction(url, obj).then(res => {
            //     if (res.data.success) {
            //         let randomTags = getRandomArrayElements(res.data.result, 2);
            //         that.researchTags = res.data.result;
            //         that.getRecommendTalent(randomTags.map(item=>{return item.name;}));
            //     }
            // }).catch(err => {
            //     console.log(err)
            // })
            this.gwFieldNames = this.talentInfo.gwFieldNames ? this.talentInfo.gwFieldNames.split(",") : null;
            let resultArr = this.talentInfo.s ? this.talentInfo.s.split(",") : null;
            if (resultArr) {
                let randomTags = getRandomArrayElements(resultArr, 2);
                this.researchTags = getRandomArrayElements(resultArr, 8);
                this.getRecommendTalent(randomTags.map(item => {
                    return item;
                }));
            }
        },
        getTalentInfoData() {
            let url = "/talents/getTalentInfo";
            postAction(url, {authorId: this.selectedAuthorId}).then(res => {
                if (res.data.success) {
                    this.talentInfo = res.data.result
                    this.talentFields = this.talentInfo.talentFields ? this.talentInfo.talentFields.split(",") : null;
                    // this.getTalentFieldTagData();
                    this.talentResearchTrendDataList = JSON.parse(res.data.result.talentResearchTrendDataList);
                    if(this.talentResearchTrendDataList != null){
                        this.getResearchChartsData(this.talentResearchTrendDataList);
                    }
                    this.talentRelatedResearchFieldFruitDataList = JSON.parse(res.data.result.talentRelatedResearchFieldFruitDataList);
                    if(this.talentRelatedResearchFieldFruitDataList != null){
                        this.getResearchFieldFruitCharts(this.talentRelatedResearchFieldFruitDataList);
                    }
                    this.talentFruitWordCloudDataList = JSON.parse(res.data.result.talentFruitWordCloudDataList);
                    if(this.talentFruitWordCloudDataList != null){
                        this.getFruitWordCloudData(this.talentFruitWordCloudDataList);
                    }
                    this.talentRelatedYgDataList = JSON.parse(res.data.result.talentRelatedYgDataList);
                    if(this.talentRelatedYgDataList != null){
                        this.getRelatedYgData(this.talentRelatedYgDataList);
                    }
                    this.talentRelatedTalentDataList = JSON.parse(res.data.result.talentRelatedTalentDataList);
                    // if(this.talentRelatedTalentDataList != null){
                    //     this.getRelatedTalentData(this.talentRelatedTalentDataList);
                    // }
                    this.handleTabChange('rrff');
                    this.handleTabChange('rank');
                    this.getLikeData();
                }
            }).catch(err => {
                console.log(err)
            })
            this.getFruitData();
            this.getTalentFileNum();
        },
        getFruitData() {
            let fruitUrl = "/talents/getPageTalentFruitList";
            this.searchTalentFruitObj.authorId = this.selectedAuthorId;
            // this.searchTalentFruitObj.authorName = this.selectedAuthorName;
            this.searchTalentFruitObj.searchType = 1;
            this.isHaveData = false;
            postAction(fruitUrl, this.searchTalentFruitObj).then(res => {
                if (res.data.success) {
                    this.productions.total = res.data.result.total
                    this.productions.dataList = res.data.result.records
                    this.isHaveData = true;
                }
            }).catch(err => {
                console.log(err)
            })
        },
        changeType(val) {
            this.selectedFruitType = val;
            this.getFruitData(val);
        },
        onChangePage(value) {
            this.searchTalentFruitObj.pageNo = value;
            this.currentPage = value;
            this.getFruitData();

            window.scrollTo({
                top: 1500,
                behavior: 'smooth', // 使用平滑滚动
            });
        },
        getTalentFileNum() {
            let url = "/file/getTalentFileNum";
            commonPostAction(url, {relationId: this.selectedAuthorId}).then(res => {
                if (res.data.success) {
                    this.talentFileNum = res.data.result;
                }
            }).catch(err => {
                console.log(err)
            })
        },
        getResearchChartsData(data) {
            let legendData = [];
            let seriesData = [];
            for (let n in data) {
                let result = [];
                result[0] = data[n].yearNum;
                result[1] = data[n].count;
                result[2] = data[n].name;
                legendData.push(data[n].name);
            }
            this.buildResearchCharts(Array.from(new Set(legendData)), data);
        },
        buildResearchCharts(legendData, seriesData) {
            let researchCharts = echarts.init(this.$refs.researchCharts);
            this.buildResearchCategoryCharts(researchCharts, legendData, seriesData);
        },
        buildResearchCategoryCharts(researchCharts, legendData, seriesData) {

            var groupedData = {};
            var allUniqueYears = new Set(); // 用于存储所有独特的年份

            // 遍历输入数据，按 name 进行分组，并收集独特年份
            seriesData.forEach(function (item) {
                if (!groupedData[item.name]) {
                    groupedData[item.name] = {};
                }

                // 使用 yearNum 作为属性，存储每个 yearNum 对应的 count 值
                groupedData[item.name][item.yearNum] = item.count;
                allUniqueYears.add(item.yearNum); // 添加年份到独特年份集合中
            });

            // 将所有独特年份转换为一个排序后的数组
            var sortedUniqueYears = Array.from(allUniqueYears).sort((a, b) => a - b);

            var newDataArray = [];

            // 遍历每个 name，构建新的数组结构
            for (var name in groupedData) {
                var newDataItem = {
                    name: name, // 使用 name 字段的值作为 name
                    type: 'line',
                    smooth: true,
                    data: sortedUniqueYears.map(year => groupedData[name][year] || 0) // 使用映射来填充数据
                };

                // 将 newDataItem 添加到新的数组结构中
                newDataArray.push(newDataItem);
            }

            // 生成不同的颜色
            function generateUniqueColors(count) {
                var colors = [];
                for (var i = 0; i < count; i++) {
                    var hue = (360 / count) * i;
                    var lightness = (i % 2 === 0 ? 30 : 70) / 100; // 转换为0-1范围
                    var color = `hsl(${hue}, 100%, ${lightness})`;
                    colors.push(color);
                }
                return colors;
            }

            // 定义颜色数量（应与系列数据的数量相匹配，或根据需要调整）
            var colorCount = Object.keys(groupedData).length; // 或使用您想要的颜色数量
            var customColors = generateUniqueColors(28);

            // 假设 researchCharts 是已经初始化的图表实例
            researchCharts.setOption({
                // color: customColors,
                legend: {
                    top: '10px',
                    data: Object.keys(groupedData) // 使用分组数据的键作为图例数据
                },
                grid: {
                    top: colorCount > 6 ? '200px' : '100px',
                    bottom: '50px'
                },
                tooltip: {
                    trigger: 'axis',
                    extraCssText: 'z-index: 7',
                    backgroundColor: '#FFFFFF',
                    textStyle: {
                        color: '#3c3520'
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: sortedUniqueYears // 使用排序后的独特年份作为x轴数据
                },
                yAxis: {
                    type: 'value',
                    minInterval: 1
                },
                series: newDataArray
            }, true);

            setTimeout(function () {
                researchCharts.resize();
            }, 10)
        },
        getResearchFieldFruitCharts(data) {
            // this.buildResearchChart(resultData);
            this.buildResearchPieChart(data);
        },
        buildResearchChart(resultData) {
            let rfCharts = echarts.init(this.$refs.researchFieldChart);
            let linksArr = []
            let nodesArr = []
            let max = 0
            if (resultData != null && resultData.length > 0) {
                resultData.forEach(v => {
                    linksArr.push({
                        source: v.start_node,
                        target: v.end_node,
                        sourceName: v.start_node_name,
                        targetName: v.end_node_name,
                        value: v.cross_times
                    })
                    if (nodesArr.length === 0) {
                        nodesArr = [
                            {
                                id: v.start_node,
                                name: v.start_node_name,
                                value: v.cross_times
                            },
                            {
                                id: v.end_node,
                                name: v.end_node_name,
                                value: v.cross_times
                            }
                        ]
                        max = Math.max(max, v.cross_times)
                    } else {
                        const sourceItem = nodesArr.findIndex(j => j.id === v.start_node)
                        if (sourceItem < 0) { // 找不到相同的起始路段的id
                            nodesArr.push({
                                id: v.start_node,
                                name: v.start_node_name,
                                value: v.cross_times
                            })
                            max = Math.max(max, v.cross_times)
                        } else { // 累加value的值
                            nodesArr[sourceItem].value += v.cross_times
                            max = Math.max(max, nodesArr[sourceItem].value)
                        }
                        const targetItem = nodesArr.findIndex(j => j.id === v.end_node)
                        if (targetItem < 0) { // 找不到相同的结束路段的id
                            nodesArr.push({
                                id: v.end_node,
                                name: v.end_node_name,
                                value: v.cross_times
                            })
                            max = Math.max(max, v.cross_times)
                        } else { // 累加value的值
                            nodesArr[targetItem].value += v.cross_times
                            max = Math.max(max, nodesArr[targetItem].value)
                        }
                    }
                })

                nodesArr.forEach(v => { // 按照最大值平均分16等份，并设置nodes的symbolSize
                    v.symbolSize = this.averageSize(v.value, max)
                    v.category = v.name
                    v.label = {
                        normal: {
                            show: true
                        }
                    }
                })

                let sliNumer = 0
                try {
                    sliNumer = Math.ceil(nodesArr.length / 4)
                } catch (error) {
                    sliNumer = 0
                }
                if (sliNumer > 0) { // 因和弦图设置为环形状态时，默认会从90度位置顺时针旋转显示，所以把最初始的四分之一数据，添加到最后，即可实现从0度开始顺时针旋转的效果，可根据业务自定义更改数据的位置
                    let nodeCopyArr = nodesArr
                    nodesArr = (nodeCopyArr.slice(sliNumer, nodeCopyArr.length)).concat(nodeCopyArr.slice(0, sliNumer))
                }
            }
            let categoriesArr = nodesArr.length > 0 ? nodesArr.map(v => {
                return {name: v.name}
            }) : [] // 筛选出所有路段的名称
            rfCharts.setOption(
                {
                    // color: ['#ff0000', '#f00000'], // 可自定义多种颜色
                    tooltip: {},
                    animationDurationUpdate: 1500,
                    animationEasingUpdate: 'quinticInOut',
                    legend: [
                        {
                            data: nodesArr.map(function (a) {
                                return a.name;
                            })
                        }
                    ],
                    series: [
                        {
                            type: 'graph',
                            layout: 'circular',
                            top: '100px',
                            width: '50%',
                            circular: {
                                rotateLabel: true
                            },
                            data: nodesArr, // 所有路段的数据
                            links: linksArr, // 路段连接的数据
                            categories: categoriesArr, // 所有路段的名称数据
                            roam: true,
                            label: {
                                position: 'right',
                                formatter: '{b}'
                            },
                            lineStyle: {
                                color: 'source',
                                curveness: 0.3
                            }
                        }
                    ]
                }
            )
            setTimeout(function () {
                rfCharts.resize();
            }, 10)
        },
        buildResearchPieChart(resultData) {
            let rfCharts = echarts.init(this.$refs.researchFieldChart);
            let serialData = [];
            if (resultData != null && resultData.length > 0) {
                resultData.forEach(v => {
                    serialData.push({"name": v.name, "value": v.count})
                })
            }
            rfCharts.setOption({
                tooltip: {
                    trigger: 'item'
                },
                series: [
                    {
                        type: 'pie',
                        radius: '50%',
                        center: ['50%', '40%'],
                        itemStyle: {
                            borderRadius: 8
                        },
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        },
                        label: {
                            show: true,
                            formatter: function (params) {
                                // return params.name + " （" + params.value + "）";
                                return params.name;
                            }
                        },
                        data: serialData
                    }
                ]
            }, true);

            setTimeout(function () {
                rfCharts.resize();
            }, 10)
        },
        averageSize(res, max, commSize = 16) { // 平均分为16等份，等份可自定义
            const step = max / commSize
            const level = Math.ceil(res / step)
            return level * 2 + 6
        },
        // buildResearchFieldCharts(graph){
        //   let rfCharts = echarts.init(this.$refs.researchFieldChart);
        //   graph.nodes.forEach(function (node) {
        //     node.label = {
        //       show: node.symbolSize > 30
        //     };
        //   });
        //   rfCharts.setOption({
        //     title: {
        //       text: 'Les Miserables',
        //       subtext: 'Circular layout',
        //       top: 'bottom',
        //       left: 'right'
        //     },
        //     tooltip: {},
        //     legend: [
        //       {
        //         data: graph.categories.map(function (a) {
        //           return a.name;
        //         })
        //       }
        //     ],
        //     animationDurationUpdate: 1500,
        //     animationEasingUpdate: 'quinticInOut',
        //     series: [
        //       {
        //         name: 'Les Miserables',
        //         type: 'graph',
        //         layout: 'circular',
        //         circular: {
        //           rotateLabel: true
        //         },
        //         data: graph.nodes,
        //         links: graph.links,
        //         categories: graph.categories,
        //         roam: true,
        //         label: {
        //           position: 'right',
        //           formatter: '{b}'
        //         },
        //         lineStyle: {
        //           color: 'source',
        //           curveness: 0.3
        //         }
        //       }
        //     ]
        //   })
        //
        //   setTimeout(function () {
        //     rfCharts.resize();
        //   }, 10)
        // },
        getFruitWordCloudData(data) {
            this.isHaveWordData = true;
            this.wordData = data;
        },
        buildFruitWordCloudLine(fruitData) {
            let fruitChart = echarts.init(this.$refs.fruitLineChart);
            let legendData = ["学术论文", "研究报告", "图书出版", "活动成果", "媒体成果", "荣誉信息", "专利成果", "软著成果"];
            let lineXsData = [];
            let lwSeriesData = [0, 0, 0, 0, 0];
            let bgSeriesData = [0, 0, 0, 0, 0];
            let tsSeriesData = [0, 0, 0, 0, 0];
            let hdSeriesData = [0, 0, 0, 0, 0];
            let mtSeriesData = [0, 0, 0, 0, 0];
            let rySeriesData = [0, 0, 0, 0, 0];
            let zlSeriesData = [0, 0, 0, 0, 0];
            let rzSeriesData = [0, 0, 0, 0, 0];
            //补齐近五年的值
            for (let i = 4; i >= 0; i--) {
                let yearName = (this.currentYear - i) + "";
                lineXsData.push(yearName);
                for (let n in fruitData) {
                    if (parseInt(fruitData[n].yearNum) == yearName) {
                        if (fruitData[n].name == 6) {
                            lwSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 3) {
                            bgSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 7) {
                            tsSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 4) {
                            hdSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 5) {
                            mtSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 8) {
                            rySeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 11) {
                            zlSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 10) {
                            rzSeriesData[i] = fruitData[n].count;
                        }
                    }
                }
            }
            fruitChart.setOption({
                legend: {
                    bottom: '1px',
                    data: legendData
                },
                grid: {
                    top: '50px',
                    bottom: '150px'
                },
                tooltip: {
                    alwaysShowContent: true,
                    trigger: 'axis',
                    extraCssText: 'z-index: 7',
                    backgroundColor: '#FFFFFF',
                    textStyle: {
                        color: '#3c3520'
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: lineXsData
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name: '学术论文',
                        type: 'line',
                        stack: 'Total',
                        data: lwSeriesData
                    },
                    {
                        name: '研究报告',
                        type: 'line',
                        data: bgSeriesData
                    },
                    {
                        name: '图书出版',
                        type: 'line',
                        data: tsSeriesData
                    },
                    {
                        name: '活动成果',
                        type: 'line',
                        data: hdSeriesData
                    },
                    {
                        name: '媒体成果',
                        type: 'line',
                        data: mtSeriesData
                    },
                    {
                        name: '荣誉信息',
                        type: 'line',
                        data: rySeriesData
                    },
                    {
                        name: '专利成果',
                        type: 'line',
                        data: zlSeriesData
                    },
                    {
                        name: '软著成果',
                        type: 'line',
                        data: rzSeriesData
                    },
                ]
            }, true);
            setTimeout(function () {
                fruitChart.resize();
            }, 10)
        },
        buildFruitWordCloudChard(fruitData) {
            let fruitChart = echarts.init(this.$refs.fruitLineChart);
            let legendData = ["学术论文", "研究报告", "图书出版", "活动成果", "媒体成果", "荣誉信息", "专利成果", "软著成果"];
            let lineXsData = [];
            let lwSeriesData = [0, 0, 0, 0, 0];
            let bgSeriesData = [0, 0, 0, 0, 0];
            let tsSeriesData = [0, 0, 0, 0, 0];
            let hdSeriesData = [0, 0, 0, 0, 0];
            let mtSeriesData = [0, 0, 0, 0, 0];
            let rySeriesData = [0, 0, 0, 0, 0];
            let zlSeriesData = [0, 0, 0, 0, 0];
            let rzSeriesData = [0, 0, 0, 0, 0];
            //补齐近五年的值
            for (let i = 4; i >= 0; i--) {
                let yearName = (this.currentYear - i) + "";
                lineXsData.push(yearName);
                for (let n in fruitData) {
                    if (parseInt(fruitData[n].yearNum) == yearName) {
                        if (fruitData[n].name == 6) {
                            lwSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 3) {
                            bgSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 7) {
                            tsSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 4) {
                            hdSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 5) {
                            mtSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 8) {
                            rySeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 11) {
                            zlSeriesData[i] = fruitData[n].count;
                        } else if (fruitData[n].name == 10) {
                            rzSeriesData[i] = fruitData[n].count;
                        }
                    }
                }
            }
            fruitChart.setOption({
                legend: {
                    bottom: '1px',
                    data: legendData
                },
                grid: {
                    top: '50px',
                    bottom: '150px'
                },
                tooltip: {
                    alwaysShowContent: true,
                    trigger: 'axis',
                    extraCssText: 'z-index: 7',
                    backgroundColor: '#FFFFFF',
                    textStyle: {
                        color: '#3c3520'
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: lineXsData
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name: '学术论文',
                        type: 'line',
                        stack: 'Total',
                        data: lwSeriesData
                    },
                    {
                        name: '研究报告',
                        type: 'line',
                        data: bgSeriesData
                    },
                    {
                        name: '图书出版',
                        type: 'line',
                        data: tsSeriesData
                    },
                    {
                        name: '活动成果',
                        type: 'line',
                        data: hdSeriesData
                    },
                    {
                        name: '媒体成果',
                        type: 'line',
                        data: mtSeriesData
                    },
                    {
                        name: '荣誉信息',
                        type: 'line',
                        data: rySeriesData
                    },
                    {
                        name: '专利成果',
                        type: 'line',
                        data: zlSeriesData
                    },
                    {
                        name: '软著成果',
                        type: 'line',
                        data: rzSeriesData
                    },
                ]
            }, true);
            setTimeout(function () {
                fruitChart.resize();
            }, 10)
        },
        getRelatedYgData(data) {
            this.getRelatedYgChart(data);
        },
        getRelatedYgChart(fruitData) {
            let fruitChart = echarts.init(this.$refs.groupYgCharts);
            let scholarsData = fruitData.map((item, idx) => {
                return {
                    name: item.name,
                    itemStyle: {
                        normal: {
                            color: '#37A095'
                        }
                    },
                }
            })
            let links = fruitData.map(item => {
                return {
                    source: this.selectedAuthorName,
                    target: item.name,
                    label: {
                        show: true,
                        fontSize: 12,
                        formatter: function (params) {
                            return item.deptName;
                        }
                    },
                    // name: '合作次数' + item.count,
                    itemStyle: {
                        normal: {
                            color: '#2b579a'
                        }
                    }
                }
            })
            fruitChart.setOption({
                series: [{
                    top: 40,
                    type: 'graph', // 类型:关系图
                    layout: 'circular', //图的布局，类型为力导图
                    height: '70%',
                    symbolSize: [50, 30], // 调整节点的大小
                    roam: true, // 是否开启鼠标缩放和平移漫游。默认不开启。如果只想要开启缩放或者平移,可以设置成 'scale' 或者 'move'。设置成 true 为都开启
                    edgeSymbol: ['circle', 'arrow'],
                    edgeSymbolSize: [2, 8],
                    edgeLabel: {
                        normal: {
                            textStyle: {
                                fontSize: 20
                            },
                            show: true,
                            formatter: function (x) {
                                return x.data.name;
                            }
                        }
                    },
                    force: {
                        repulsion: 2500,
                        edgeLength: [10, 50]
                    },
                    // draggable: true,
                    lineStyle: {
                        normal: {
                            width: 2,
                            color: '#4b565b',
                            opacity: 0.9,
                            curveness: 0.1, // 调整连线的曲度
                        }
                    },
                    label: {
                        normal: {
                            show: true,
                            textStyle: {}
                        }
                    },

                    // 数据
                    data: [
                        {
                            name: this.selectedAuthorName,
                            itemStyle: {
                                normal: {
                                    color: '#2b579a'
                                }
                            },
                        },
                        ...scholarsData
                    ],
                    links: [
                        ...links
                    ],
                }]
            }, true);

            setTimeout(function () {
                fruitChart.resize();
            }, 10)
        },
        handleTabChange(key) {
            if (key === 'rank' && this.talentRelatedTalentDataList.length > 0) {
                this.$nextTick(() => {
                    this.buildRankTalentChart(this.talentRelatedTalentDataList);
                });
            } else if (key === 'related' && this.talentRelatedTalentDataList.length > 0) {
                this.$nextTick(() => {
                    this.buildRelatedTalentChart(this.talentRelatedTalentDataList);
                });
            } else if (key === 'rrff' && this.talentRelatedTalentDataList.length > 0) {
                this.$nextTick(() => {
                    this.getResearchFieldFruitCharts(this.talentRelatedResearchFieldFruitDataList);
                });
            }
        },
        getRelatedTalentData(data) {
            this.buildRelatedTalentChart(data);
            this.buildRankTalentChart(data);
        },
        buildRelatedTalentChart(fruitData) {
            if (this.$refs.groupTalentCharts) {
                let fruitChart = echarts.init(this.$refs.groupTalentCharts);
                let scholarsData = fruitData.map(item => {
                    return {
                        name: item.name,
                        itemStyle: {
                            normal: {
                                color: '#37A095'
                            }
                        }
                    }
                })
                let links = fruitData.map(item => {
                    return {
                        source: this.selectedAuthorName,
                        target: item.name,
                        label: {
                            show: false,
                        },
                        name: '合作论文数' + item.count,
                        itemStyle: {
                            normal: {
                                color: '#2b579a'
                            }
                        }
                    }
                })
                fruitChart.setOption({
                    tooltip: {
                        formatter: function (x) {
                            return x.data.des;
                        }
                    },
                    series: [{
                        top: 10,
                        type: 'graph', // 类型:关系图
                        layout: 'circular', //图的布局，类型为力导图
                        height: '70%',
                        symbol: 'roundRect',
                        symbolSize: [50, 30], // 调整节点的大小
                        roam: true, // 是否开启鼠标缩放和平移漫游。默认不开启。如果只想要开启缩放或者平移,可以设置成 'scale' 或者 'move'。设置成 true 为都开启
                        // edgeSymbol: ['circle', 'arrow'],
                        edgeSymbolSize: [2, 8],
                        edgeLabel: {
                            normal: {
                                textStyle: {
                                    fontSize: 20
                                },
                                show: true,
                                formatter: function (x) {
                                    return x.data.name;
                                }
                            }
                        },
                        force: {
                            repulsion: 2500,
                            edgeLength: [10, 50]
                        },
                        // draggable: true,
                        lineStyle: {
                            normal: {
                                width: 2,
                                color: '#4b565b',
                                opacity: 0.9,
                                curveness: 0.1, // 调整连线的曲度
                            }
                        },
                        label: {
                            normal: {
                                show: true,
                                textStyle: {}
                            }
                        },

                        // 数据
                        data: [
                            {
                                name: this.selectedAuthorName,
                                itemStyle: {
                                    normal: {
                                        color: '#2b579a'
                                    }
                                }
                            },
                            ...scholarsData
                        ],
                        links: [
                            ...links
                        ],
                    }]
                }, true);
                setTimeout(function () {
                    fruitChart.resize();
                }, 10)
            }
        },
        buildRankTalentChart(fruitData) {
            let fruitChart = echarts.init(this.$refs.groupRankCharts);
            let xAxisData = fruitData.map(item => {
                return item.name
            })
            let seriesData = fruitData.map(item => {
                return item.count
            })
            fruitChart.setOption({
                grid: {
                    top: 10,
                    bottom: 120,
                },
                xAxis: {
                    type: 'category',
                    data: xAxisData,
                    axisLabel: {
                        inside: false,
                        color: '#000',
                        interval: 0,
                        formatter: function (value) {
                            return value.split('').join('\n')
                        }
                    },
                    axisTick: {
                        show: false
                    },
                    axisLine: {
                        show: false
                    },
                    z: 10
                },
                dataZoom: [
                    {
                        type: 'inside'
                    }
                ],
                yAxis: {
                    type: 'value',
                    minInterval: 1
                },
                tooltip: {
                    alwaysShowContent: true,
                    trigger: 'axis',
                    extraCssText: 'z-index: 7',
                    backgroundColor: '#FFFFFF',
                    textStyle: {
                        color: '#3c3520'
                    }
                },
                series: [
                    {
                        data: seriesData,
                        type: 'bar',
                        showBackground: true,
                        itemStyle: {
                            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                {offset: 0, color: '#79DBBA'},
                                {offset: 0.5, color: '#3FA598'},
                                {offset: 1, color: '#008080'}
                            ])
                        },
                        emphasis: {
                            itemStyle: {
                                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                    {offset: 0, color: '#79DBBA'},
                                    {offset: 0.5, color: '#3FA598'},
                                    {offset: 1, color: '#008080'}
                                ])
                            }
                        },
                    }
                ]
            }, true);

            setTimeout(function () {
                fruitChart.resize();
            }, 10)
        },
        getRecommendTalent(fieldNames) {
            let url = "/fruit/getRecommendTalent";

            let obj = {orgUserId: this.selectedAuthorId, fieldNames: fieldNames};
            postAction(url, obj).then(res => {
                if (res.data.success) {
                    // this.buildRelatedTalentChart(res.data.result.result);
                    // this.buildRankTalentChart(res.data.result.result);
                    this.talentRecommendData = res.data.result.result;
                }
            }).catch(err => {
            })
        },
        showFruitInfo(item) {
            this.$nextTick(() => {
                this.$refs.fruitInfo.showModalInfo(item);
            })
        },

        handleFileRemove(file) {
            const index = this.talentFileList.indexOf(file);
            const newFileList = this.talentFileList.slice();
            newFileList.splice(index, 1);
            this.talentFileList = newFileList;
        },
        fileBeforeUpload(file) {
            let imgTypeArr = ['pdf','docx','doc','xlsx','xls','ppt','pptx','jpg','jpeg','png','zip','rar'];
            let imgType = imgTypeArr.indexOf(file.name.substring(file.name.lastIndexOf('.') + 1)) !== -1
            if (!imgType) {
                this.$message.warning({
                    content:  '文件格式不正确, 请选择pdf、docx、doc、xlsx、xls、ppt、pptx、jpg、jpeg、png、zip、rar格式的文件',
                    duration: 5
                });
                return false
            }
            // 判断文件大小
            const isLt2M = file.size / 1024 < Setting.uploadFileMaxSize;
            if (!isLt2M) {
                this.$message.error('上传附件大小不能超过 20MB!');
                return false;
            }
            return true;
        },
        uploadSuccess(info) {
            this.talentFileList = info.fileList;
            if (info.file.status === 'done') {
                this.$message.success(`${info.file.name} 文件上传成功`);
                this.getTalentFileData();
                this.getTalentFileNum();
            } else if (info.file.status === 'error') {
                this.$message.error(`${info.file.name} file upload failed.`);
            }
        },
        toShareResources(){
            this.uploadModal = true;
            if(Setting.isMock) {
                window.localStorage.setItem('sysUserId', "1229");
                window.localStorage.setItem('realname', "李正正");
            }
            let uploadUserId = window.localStorage.getItem('sysUserId');
            let uploadUserName = window.localStorage.getItem('realname');
            this.uploadData = {
                relationId: this.selectedAuthorId,
                uploadUserId: uploadUserId,
                uploadUserName: uploadUserName,
            };
            this.getTalentFileData();
        },
        getTalentFileData(){
            let url = "/file/list";
            this.searchTalentFileObj.relationId = this.selectedAuthorId;
            this.searchTalentFileObj.pageNo = 1;
            this.isHaveFileData = true;
            commonPostAction(url, this.searchTalentFileObj).then(res => {
                if (res.data.success) {
                    this.talentFileData.total = parseInt(res.data.result.total)
                    this.talentFileData.dataList = res.data.result.records
                    this.isHaveFileData = false;
                }
            }).catch(err => {
            })
        },
        onChangeTalentFilePage(value) {
            this.searchTalentFileObj.pageNo = value;
            this.currentFilePage = value;
            this.getTalentFileData();
        },
        deleteFile(record) {
            try {
                let url = "/file/delete";
                let that = this;
                commonPostAction(url, record).then(res => {
                    if (res.data.success) {
                        that.$message.success('操作成功');
                        that.getTalentFileData();
                        this.getTalentFileNum();
                    }
                }).catch(err => {
                    console.log(err)
                })
            } catch (error) {
                console.error('Error deleting record:', error);
            }
        },
        downloadFileData(record){
            downloadData("/file/downloadFileData", record, record.name)
        },
        getLikeData(){
            this.searchTalentLikeObj = {};
            if(Setting.isMock) {
                window.localStorage.setItem('sysUserId', "1229");
                window.localStorage.setItem('realname', "李正正");
            }
            let userId = window.localStorage.getItem('sysUserId');

            let url = "/evaluate/list";
            this.searchTalentLikeObj.talentId = this.selectedAuthorId;
            this.searchTalentLikeObj.userId = userId;
            commonPostAction(url, this.searchTalentLikeObj).then(res => {
                if (res.data.success) {
                    if(res.data.result.length > 0){
                        this.likeData = res.data.result;
                    }
                }
            }).catch(err => {
            })
        },
        changeLike(index, value){
            this.likeData[index].likeCount = value;
            this.likeData.map(item=>{
                item.talentId = this.searchTalentLikeObj.talentId;
                item.userId = this.searchTalentLikeObj.userId;
                return item;
            })

            let url = "/evaluate/save";
            this.searchTalentLikeObj.evaluateList = this.likeData;
            commonPostAction(url, this.searchTalentLikeObj).then(res => {
            }).catch(err => {
            })
        }
    }
}
</script>
<style scoped>

    /deep/ .ant-card-body {
        padding: 20px !important;
    }

    /deep/ .ant-card-head {
        min-height: 20px !important;
    }

    /deep/ .ant-card-head-title {
        padding: 5px 0 !important;
    }

    /deep/ .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
        background: #1DA57A !important;
        color: #fff !important;
    }

    .infoIpt{
        padding: 10px;
    }

    .divTitle{
        margin-bottom: -1px;
        background: transparent;
        zoom: 1;
        font-size: 1.2rem;
        font-weight: bold;
        color: #189583;
        padding: 5px 24px;
    }

    .blank-content{
        display: flex;
        justify-content: center;
        align-items: center;
        height: 300px;
    }

    .ant-tag {
        margin-top: 2px !important;
    }

    .sit {
        line-height: 100px;
        color: rgba(3, 129, 129, 1);
        font-size: 48px;
        text-align: center;
    }

    .searchIpt {
        height: 200px;
        width: 800px;
        margin: 200px auto;
    }

    .cardTit {
        border-radius: 50px;
        font-weight: bold;
        margin-top: 20px;
        font-size: 16px;
        color: #ffffff;
        background: linear-gradient(90.7deg, rgba(24, 149, 131, 1) 3.45%, rgba(255, 255, 255, 1) 97.86%);
    }

    .fruit-type-name {
        text-align: center;
        cursor: pointer;
        height: 40px;
        line-height: 40px;
        font-weight: 400;
    }

    .fruit-type-name-default {
        font-size: 16px;
        background-color: rgba(90, 216, 166, 1);;
        color: #ffffff;
    }

    .fruit-type-name-append {
        font-size: 20px;
        background-color: #189583;
        color: #ffffff;
    }

    .typeRadius-left {
        border-radius: 10px 0 0 10px;
    }

    .typeRadius-right {
        border-radius: 0 10px 10px 0;
    }

    .ft {
        font-weight: bold;
        font-size: 20px;
        cursor: pointer;
    }

    .pag {
        padding: 15px 20px;
        text-align: center;
    }

    .tjt {
        color: #038181;
        font-weight: bold;
        font-size: 20px;
        padding-left: 20px;
        line-height: 60px;
        background-color: rgba(239, 250, 251, 1);
        border-radius: 10px;
    }

    .tct {
        color: #fff;
        font-weight: bold;
        font-size: 20px;
        line-height: 60px;
        text-align: center;
        background: linear-gradient(90.45deg, rgba(84, 211, 170, 1) 0.01%, rgba(147, 227, 201, 1) 100.02%);
    }

    .ctc {
        padding: 10px;
        line-height: 26px;
        font-size: 18px;
        background-color: rgba(255, 255, 255, 1);
        color: rgba(16, 16, 16, 1);
    }

    .rd {
        border-radius: 0 0 10px 10px;
    }

    #components-back-top-demo-custom .ant-back-top {
        bottom: 100px;
        right: 20px;
    }

    #components-back-top-demo-custom .ant-back-top-inner {
        height: 40px;
        width: 40px;
        line-height: 40px;
        border-radius: 4px;
        background-color: rgba(0, 128, 128, 1);
        color: #fff;
        text-align: center;
        font-size: 20px;
    }

    .info {
        margin: .5rem 2rem;
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .t-title {
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 50px;
    }

    .t-company {
        font-size: 0.9rem;
        font-weight: bold;
        padding-top: 10px;
    }

    .nameCsp {
        font-size: 15px;
        line-height: 20px;
        color: #323232;
        opacity: 1;
    }
</style>